package cn.edu.bupt.ch10_1.msorder.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/order/lb")
public class OrderController {
    @Autowired
    private RestTemplate restTemplate;
    @Value("${username}")
    private String test;
    @GetMapping("/{product_uuid}/{num}")
    public String create(@PathVariable("product_uuid") String product_uuid,
                         @PathVariable("num") String num){
        String REST_URL_PREFIX = "http://MS-INVENTORY";
        String res = restTemplate.getForObject(REST_URL_PREFIX+"/production/deduct/"
                +product_uuid+"/"+num,String.class);
        return res;
    }

}
